<template>
	<view class="info">
		<view class="infoItem" v-for="item in info" :key="item.id" @click="infoItemClick(item.id)">
			<image src="../../static/fj.jpg" alt="">
			<view class="right">
				<view class="title">{{item.title}}</view>
				<view class="mes">
					<text>发表时间：{{item.add_time | formatDate}}</text>
					<text>浏览：{{item.click}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:[]
			}
		},
		methods: {
			async getNews () {
				const res = await this.$myRequest({
					url: '/api/getnewslist'
				})
				this.info = res.data.message			
			},
			infoItemClick(id){
				uni.navigateTo({
					url:"../informationDetail/informationDetail?id="+id
				})
			}
		},
		onLoad(){
			this.getNews()
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
		width: 100%;
		background:#fff;
		.info{	
			width: 100%;	
			margin-bottom: 100rpx;
			.infoItem{
				width: 100%;
				border-bottom: 1rpx solid #b50e03;
				padding: 10rpx 20rpx;
				display: flex;
				image{
					display: block;
					height: 150rpx;
					min-width: 200rpx;
					max-width: 200rpx;
				}
				.right{
					width: 510rpx;
					margin-left: 20rpx;
					margin-right:28rpx ;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					.title{
						font-size: 30rpx;
					}
					.mes{
						font-size: 24rpx;
						text:nth-child(2){
							margin-left: 60rpx;
						}
					}
				}
			}
		}
	}
</style>
